<template>
  <el-select v-bind="$attrs" v-on="$listeners" v-model="modelValue">
    <el-option v-for="(option, index) in options" :key="index" :label="option[filedLabel]" :value="option[filedValue]">
    </el-option>
  </el-select>
</template>

<script>
export default {
  props: {
    value: {
      required: true,
    },
    options: {
      type: Array,
      default: () => [],
    },
    filedLabel: {
      type: String,
      default: 'label'
    },
    filedValue: {
      type: String,
      default: 'value'
    }
  },
  computed: {
    modelValue: {
      get () {
        return this.value
      },
      set (val) {
        this.$emit('input', val)
      },
    },
  },
}
</script>
